package com.czxy.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseResult {

    private Integer code;//状态码  10000 成功   20000 失败
    private String msg;//成功或者失败的提示消息
    private Object data;

    public BaseResult(String msg) {
        this.msg = msg;
    }

    public BaseResult(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static BaseResult ok(){
        return new BaseResult(10000,"成功");
    }

//    public static BaseResult ok(String msg){
//        return new BaseResult(10000,msg);
//    }

    public static BaseResult ok(Object data){
        return new BaseResult(10000,"成功",data);
    }

    public static BaseResult error(){
        return new BaseResult(20000,"失败");
    }

    public static BaseResult error(String msg){
        return new BaseResult(20000,msg);
    }


}
